import { MidwayValidationError } from '@midwayjs/validate'
import { CommonError } from './common.error'
import { httpError } from '@midwayjs/core'

export class BaseError {

  static error(message: string) {
    return new CommonError(message)
  }

  static validateError(message: string, code: number = 422) {
    return new MidwayValidationError(message, code, null)
  }

  static unauthrizedError(message: string) {
    return new httpError.UnauthorizedError(message)
  }

  static forbiddenError(message: string) {
    return new httpError.ForbiddenError(message)
  }

  static badRequestError(message: string) {
    return new httpError.BadRequestError(message)
  }

  
}